package com.hmall.search.web;

import com.hmall.common.dto.PageDTO;
import com.hmall.search.pojo.ItemDoc;
import com.hmall.search.pojo.RequestParams;
import com.hmall.search.service.ISearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("search")
@Slf4j
public class SearchController {

    @Autowired
    ISearchService searchService;

    /**
     * 基本搜索
     * @param requestParams
     * @return
     */
    @PostMapping("list")
    public PageDTO<ItemDoc> ItemByPage(@RequestBody RequestParams requestParams) throws IOException {
        // 分页查询
        PageDTO<ItemDoc> pageSearch =searchService.pageSearch(requestParams);
        log.info("分页查询：{}", pageSearch);
        return pageSearch;

    }
}


